# Copyright (c) 2014 by Michael Zahniser
#
# Endless Sky is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later version.
#
# Endless Sky is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https://www.gnu.org/licenses/>.



mission "FW Zug Expansion: Assisted"
	minor
	name "Convoy to Zug"
	description "Escort a convoy of freighters to <destination> for an important project. Expect pirate raids."
	source
		government "Free Worlds"
		near Zubeneschamali 2 4
	destination "Zug"
	to offer
		has "event: tarazed assistance"
		not "FW Diplomacy 1: done"
	on offer
		conversation
			`While returning from a walk around the spaceport of <origin>, you see the quartermaster of the spaceport inspecting your ship. He notices your arrival and comes up to greet you.`
			`	"You're Captain <first> <last>, yes? We're looking for a good ship that can escort these freighters to <planet>." He points towards five Syndicate Freighters in Free Worlds colors on the landing pads opposite to your ship, some of which have considerable hull damage and are actively being repaired.`
			`	"Their last escort was just taken out by pirates, and we need someone who is experienced enough to fend off or evade them. You must have a reputation, since some of our militia captains recognized you. This is for quite a significant project on <planet>, so you will be paid <payment>."`
			choice
				`	"What is the project? It seems to be a big enterprise."`
				`	"That's a fair few freighters. Should I be expecting any more pirates?"`
					goto pirates
				`	"Sorry, I'm not planning on going that way."`
					decline
			`	"The freighters are carrying construction materials and specialized shipbuilding equipment for a planned extension to Zug's New Port, which has been a long time coming. It would greatly help the Free Worlds' efforts. I suppose that is why there have been pirates trying to pounce on these ships; the equipment would be a rich prize for them."`
				goto meet
			label pirates
			`	"Yes, I would expect more pirate contact, because the movement of so many freighters would be a tempting target for them, and moreover, they are carrying valuable equipment for warship manufacturing. I'd certainly recommend avoiding combat when possible. In these trying times, the loss of these ships would be... not ideal."`
			label meet
			`	"Well, will you help us escort these freighters?"`
			choice
				`	"Of course, I'll get these freighters to <planet> safely."`
				`	"No, I won't be able to, sorry."`
					decline
			`	"Wonderful! I expect that these ships will benefit the Free Worlds immensely." With that, he leaves you to meet with the captains of the freighters.`
				accept
	npc accompany save
		government "Free Worlds"
		personality escort timid
		ship "Freighter" "F.S. Pohutukawa"
		ship "Freighter" "F.S. Totara"
		ship "Freighter" "F.S. Kauri"
		ship "Freighter" "F.S. Rimu"
		ship "Freighter" "F.S. Kanuka"
	npc
		government "Pirate"
		personality plunders staying
		system "Zubenelgenubi"
		fleet "Large Southern Pirates" 3
	npc
		government "Pirate"
		personality plunders staying
		system "Sabik"
		fleet "Large Southern Pirates" 2
	npc
		government "Pirate"
		personality plunders staying
		system "Hadar"
		fleet "Large Southern Pirates" 3
	npc
		government "Pirate"
		personality plunders staying
		system "Zeta Centauri"
		fleet "Large Southern Pirates" 2
	npc
		government "Pirate"
		personality plunders staying
		system "Izar"
		fleet "Large Southern Pirates" 2
	on visit
		dialog `You have reached <planet>, but you left part of the convoy behind! Better depart and wait for them to arrive in this star system.`
	on complete
		payment 600000
		event "fw zug expansion underway"
		event "fw zug expansion complete" 120
		conversation
			`The five freighters have all arrived intact, and you are told to land them beside a large area of land set aside for Zug's long-awaited New Port expansion. Not long after, you are sent <payment> by Zug's port authority.`
			`	It seems that bringing so many freighters was justified, because the expansion also includes a considerable extension to Southbound's shipbuilding facilities to make them capable of building heavy warships like Tarazed Falcons. However, by the looks of it, all this equipment would be more than enough to build a Navy Cruiser.`



mission "FW Zug Expansion: Unassisted"
	landing
	invisible
	to offer
		has "FW Diplomacy 1: done"
		not "FW Zug Expansion: Assisted: done"
	on offer
		event "fw zug expansion underway"
		event "fw zug expansion complete" 120
		fail



mission "FW Pirates: Harmony"
	landing
	source "Harmony"
	to offer
		has "FW Pirates 1: active"
	
	on offer
		conversation
			`As you land on <planet>, you recall that the monks who live here are involved in some sort of outreach to children serving as pirate crew members. They might have something to say about the best way to deal with the pirate threat. Do you want to visit them?`
			choice
				`	(Yes.)`
				`	(No.)`
					decline
			`	It's a short walk to the monastery from the spaceport. When you arrive there, you run into a monk who is working in the garden. He glances up, and recognizes you. "Welcome back," he says. "You're Katya's friend, right? I'm David. I've forgotten your name."`
			`	"<first>," you say.`
			`	He brushes some of the dirt off his hands and then shakes hands with you. "How are you doing?" he asks. "And how is Katya? And Ijs?" You explain to him that you are now an official member of the Free Worlds, and that Katya has been captured by the Republic. He is clearly shocked and saddened by the news. After pressing you for all the details, he asks, "And what about you? What brings you to Harmony?"`
			choice
				`	"The Free Worlds are hoping to eliminate piracy in this sector, and I was hoping for advice on what targets we should attack."`
				`	"The Free Worlds are thinking of launching an attack on the pirates, but I've been thinking about what Brother Greg said about the pirate crews being just kids."`
					goto kids
			`	"If you want some military advice," he says, "here's what I can tell you. You cannot create peace using violence. Most people on the pirate worlds are not pirates, just ordinary people unlucky enough to be born there. Or people who feel unwelcome everywhere else."`
				goto advice
			label kids
			`	"It's true," he says. "If you fight the pirates, innocent lives will be lost."`
			label advice
			`	"Then what do you suggest we do?" you ask.`
			`	"Well," he says, "it's worth repeating that most people on the 'pirate' worlds are not pirates. They're just anarchists. As a monk, I feel a sort of kinship with them."`
			choice
				`	"How so?"`
				`	"Naturally."`
					goto continue
			`	"For starters, we both wear black all the time," he says, grinning. "And more to the point, we're both seeking to build an alternative community according to our own ideals. Historically, monasticism can actually be seen as a form of utopic anarchism - 'Fear none but God' and all that."`
			choice
				`	"Of course."`
				`	"That makes absolutely no sense. Are you joking around with me?"`
			label continue
			`	He grins. "Well, that's a tangent, anyway. My real advice is this: figure out what the people on those pirate worlds want, and how to offer it to them. Freedom from government intervention would be a good start. But that means no annexing their territory for the Free Worlds. Instead, you could offer them some sort of pact: they stop supporting pirate fleets, and you agree to leave their planets in peace."`
			choice
				`	"Thanks for the advice. I'll see if we can work out something like that."`
				`	"No way. We need to speak the language they understand. Overwhelming force."`
					goto force
			`	He wishes you the best of luck, and you return to the port.`
				decline
			label force
			`	"It won't end," he says, "not unless you exterminate every last person on those planets. But I can't control what choices you make. Good luck." He returns to gardening, and you walk back to the spaceport.`
				decline



mission "FW Conservatory 1"
	name "Take Ijs to <planet>"
	description "Transport Mr. Eyes and the Andersons to <destination>, where he will be helping to set up a public university."
	source "Bourne"
	destination "Winter"
	passengers 3
	blocked "You meet up with Ijs in the spaceport, but he tells you that you will need three bunks for him and some friends. Return here once you have space available."
	to offer
		has "FW Senate 1B: done"
		not "fw conservatory founded"
		not "fw bloodsea done"
	
	on offer
		conversation
			branch introduce
				not "FW Katya 1: done"
			
			`When you meet Ijs in the spaceport, he has Lynn and Henry Anderson with him, the friends of Katya who you transported from Glory back before you joined the Free Worlds. Ijs is beaming - his meeting must have gone really well. "Guess what, Captain?" he says. "We've got a location for the Conservatory! The government of Winter has offered a community center for our use."`
				goto continue
			
			label introduce
			`When you meet Ijs in the spaceport, he has a man and a woman with him which he introduces as Lynn and Henry Anderson, a top planetary scientist and ex-Navy intel officer who defected from the Republic shortly after the Free Worlds were formed. Ijs is beaming - his meeting must have gone really well. "Guess what, Captain?" he says. "We've got a location for the Conservatory! The government of Winter has offered a community center for our use."`
			
			label continue
			`	"A somewhat run-down community center," adds Henry.`
			`	Ijs laughs. "True. Anyway, we were hoping you could give us a lift over there, and maybe help out with securing some equipment, too."`
			choice
				`	"Sure, I'd definitely like to help make this a reality!"`
					accept
				`	"Sorry, I've got more important business to attend to."`
			`	Ijs seems really dejected. "Are you sure?" he asks. "This could make a big difference for the Free Worlds, as much as any military victory. We could just tag along with whatever 'more important business' you have until it's convenient for you to drop us off."`
			choice
				`	"Okay, I'll help you."`
					accept
				`	"Sorry, I'm just not interested."`
					decline
	
	on visit
		dialog `You land on <planet>, but you realize that Mr. Eyes and the Andersons are on one of your escorts that hasn't entered the system yet. Better depart and wait for it to arrive.`
	on complete
		payment 50000
		dialog `Ijs thanks you for the lift and gives you a credit chip for <payment>. He says, "Next we need to pick up some equipment from Tarazed Corporation. Meet me in the spaceport if you're willing to help out as an escort."`



mission "FW Conservatory 2"
	name "Escort to <planet>"
	description "Escort this Free Worlds convoy to <destination>, to trade for terraforming equipment provided by Tarazed and the Syndicate."
	source "Winter"
	destination "Wayfarer"
	to offer
		has "FW Conservatory 1: done"
		not "fw bloodsea done"
	
	on offer
		conversation
			branch deferred
				has "FW Conservatory 2: deferred"
			`In the spaceport, it does not take long to locate Ijs; he is supervising a crew that is loading trade goods onto several Free Worlds ships. "Glad to see you, <first>," he says. "These three ships need to get to Tarazed and back without being destroyed by pirates... or by the Republic. They'll be bringing back a selection of terraforming equipment supplied from Tarazed and, if you can believe it, the Syndicate as well! I'm pretty sure they know I'm involved in this, so I wonder if this is just a ploy to keep me out of their hair after the war is over, but I won't be complaining about the help.`
			`	"Think you can tag along and protect the freighters?"`
			choice
				`	"Sure thing!"`
					accept
				`	"I've got another pressing mission. Can I come back and do this later?"`
			`	"Sure," he says. "But the longer we wait, the longer it will be until the Conservatory is up and running, so come back soon."`
				defer
			
			label deferred
			`It looks like Ijs is still in need of an escort for the freighters to bring equipment for the Conservatory from <planet> to <origin>. Do you offer to help?`
			choice
				`	(Yes.)`
				`	(No, still busy.)`
					defer
			
			`	You contact Ijs and tell him that you're ready to escort the ships. He shows you the freighters, a collection of three Argosies, and wishes you luck on your journey.`
				accept
	
	on defer
		set "FW Conservatory 2: deferred"
	
	npc accompany save
		government "Merchant"
		personality escort timid
		ship "Argosy" "F.S. Daybreak"
		ship "Argosy" "F.S. Monsoon"
		ship "Argosy" "F.S. Summer"
	npc
		government "Pirate"
		personality plunders
		system Tarazed
		fleet "Small Southern Pirates"
		fleet "Large Southern Pirates"
	
	on visit
		dialog "You have reached <planet>, but you left part of your convoy behind! Better depart and wait for them to arrive in this star system."
	on complete
		dialog `Your three escorts land safely on Tarazed. Their cargo is quickly offloaded and exchanged for the terraforming equipment that the Conservatory needs.`



mission "FW Conservatory 2B"
	landing
	name "Escort to <planet>"
	description "Escort this Free Worlds convoy of terraforming equipment back to <destination>."
	source "Wayfarer"
	destination "Winter"
	to offer
		has "FW Conservatory 2: done"
		not "fw bloodsea done"
	
	npc accompany save
		government "Merchant"
		personality escort timid
		ship "Argosy" "F.S. Daybreak"
		ship "Argosy" "F.S. Monsoon"
		ship "Argosy" "F.S. Summer"
	npc
		government "Pirate"
		personality plunders
		system "Yed Prior"
		fleet "Small Southern Pirates" 2
		fleet "Large Southern Pirates" 2
	npc
		government "Pirate"
		personality plunders
		system "Pherkad"
		fleet "Small Southern Pirates" 2
		fleet "Large Southern Pirates" 2
	
	on visit
		dialog "You have reached <planet>, but you left part of your convoy behind! Better depart and wait for them to arrive in this star system."
	on complete
		payment 300000
		event "fw conservatory founded" 30
		log "Helped to transport some items for building a public university and terraforming research center on Winter. Ijs Springborn will be one of the professors. Surprisingly, the Syndicate helped supply some of the equipment for the Conservatory."
		conversation
			`Ijs meets your convoy as it lands, and checks off each item on a clipboard as it is unloaded. Lynn is with him, looking over the various machines to make sure they are all in working order. "I hope you didn't have any trouble," says Ijs, as he hands you your payment of <payment>.`
			choice
				`	"No, none at all."`
				`	"A few pirates, nothing I couldn't handle."`
				`	"Actually, we were lucky to make it back alive."`
					goto lucky
			`	"Glad to hear it," he says.`
				goto next
			label lucky
			`	"That's too bad," he says. "This war must be making the Dirt Belt even more unstable than usual. Hopefully we'll be able to do something about that soon."`
			label next
			`	"Is there anything else you need me to do?" you ask.`
			`	"Not at the moment," he says. "I'll send you a message when we do. Thanks for your help, and if you hear any more news about Katya, please let me know."`



mission "FW Deep Memorial"
	landing
	source "Deep"
	to offer
		has "event: memorial on Deep"
		not "event: navy occupying the south"
	on offer
		conversation
			`As you disembark, you hear the sounds of warning sirens and heavy machinery coming from the edge of <planet>'s spaceport. It doesn't take long to find the source of the noise: several large construction vehicles are paving a large clearing at the edge of a cliff. At its center are nine large walls covered in letters, with spaces reserved for an additional fourteen walls. The largest wall is emblazoned with the text "Free Worlds War Memorial." Already, there are friends and family paying their respects to the ever-growing number of fallen.`
			branch "brower death" end
				has "FW Pirates: Attack 2: done"
				has "Care Package to South 1: done"
			label "brower death"
			`	As you inspect the walls, you recognize one of the names:`
			``
			`		MSGT IRENE BROWER`
			`			KILLED AT THE ATTACK ON GREENROCK`
			``
			label end
			`	The sound of construction persists as you return to the main spaceport.`
				decline




mission "FW Flamethrower 1"
	landing
	name "Weapon Testing"
	description "When you have time, report to <destination>, where Barmy Edward has another weapon he would like you to test."
	source
		near "Kraz" 1 100
	destination "Rust"
	to offer
		has "plasma turret available: offered"
		random < 15
	
	on offer
		conversation
			`A message arrives for you soon after you land. It's from Barmy Edward, the weapons engineer at Kraz Cybernetics. He writes: "Hello again, Captain! I've been working on a new weapon, and for some reason no one else wants to help out with the testing. If you're interested in getting your hands on some hot new technology, drop by Rust and come visit our factory."`
				accept



mission "FW Flamethrower 2"
	landing
	name "Weapon Testing"
	description "A test ship with new weaponry is in orbit around <planet>. Fight and disable it (but do not board or destroy it!) and then land to give Barmy Edward feedback on its performance."
	source "Rust"
	to offer
		has "FW Flamethrower 1: done"
	
	on offer
		conversation
			`You received a message recently from Barmy Edward, asking you to stop by the Kraz Cybernetics facility to help test a new weapon. Do you want to visit them now?`
			choice
				`	(Yes.)`
				`	(No.)`
					defer
			scene "scene/loc5"
			`	You give your name to the receptionist, and she directs you to the hangar where the weapons group does their design and prototyping. Barmy Edward shakes your hand warmly and says, "Here's the deal. We've got a new weapon, something a little out of the ordinary. We're hoping it will be useful against the pirates, in particular. Interested in helping us?"`
			`	"Of course," you say.`
			`	"Great," he says. "I won't share the details, because I want you to get the full effect of the surprise. But, there's a ship in orbit, the Doombat, that has been fitted with a few of these new weapons. Your job will be to fight it and disable it, then tell us what you think of its weapons."`
			`	He shakes a finger in your face and says, "Now mind you, we just want you to disable the Doombat, not destroy it. We bought it from a scrapyard, so it's barely spaceworthy, but all the same I want to be able to keep using it for future tests. Understood?"`
			choice
				`	"Okay, I promise not to destroy it or steal it."`
				`	"Sorry, this sounds a bit too risky. I'd rather not be involved in this sort of testing."`
					decline
			`	"Great," he says, rubbing his hands together with a gleeful expression on his face. He's clearly looking forward to hearing what you think of his latest invention.`
				accept
	
	npc disable save
		personality disables heroic staying
		government "Test Dummy"
		ship "Doombat" "Doombat"
	
	on visit
		dialog `You've landed on <planet>, but you have not disabled the <npc> yet. Disable it before returning.`
	on complete
		event "flamethrower available" 30
		log "Assisted Barmy Edward with another weapon test: this time, a flamethrower weapon that works by overheating and disabling its target rather than dealing lots of damage to it. It may or may not be useful in actual combat."
		conversation
			scene "outfit/flamethrower"
			`You head to the hangar to meet up with Barmy Edward, and find him tinkering with a large gun you don't recognize. Presumably, this is the Flamethrower that you were just attacked with in orbit. "It runs on hyperspace fuel, you see," he says. "So, what did you think?"`
			choice
				`	"It's a terrifying weapon."`
					goto terrifying
				`	"It looks impressive, but it didn't do very much damage."`
					goto damage
				`	"Your flamethrower doesn't seem to work very well."`
					goto bad
			label terrifying
			`	"Isn't it?" he says. "Mostly useful against small ships, of course, or ships that are running way too close to their thermal thresholds. Need to be almost on top of your target to get the full effect, too. But the ability to temporarily disable a ship without even dropping its shields first could be quite useful in certain tactical situations."`
			`	"When will it be available for sale?" you ask.`
				goto available
			label damage
			`	"No, doing damage isn't the point," he says. "The idea is to heat up the target to the point where it goes into emergency thermal shutdown. Basically a way to temporarily disable even a ship with full shields. Of course, big ships can absorb an awful lot of heat without changing temperature much, so I suspect it will be most useful against smaller targets. You've got to get right up close to them to get the full heating effect, which isn't going to be easy if you're dealing with larger warships like the Navy ones."`
			`	"That is an interesting idea," you say. "Are they available for sale yet?"`
				goto available
			label bad
			`	"Oh." He seems somewhat dejected. "Well, if you were flying a smaller ship, you might think differently. Or if your ship didn't have adequate cooling. Or maybe the Doombat didn't get close enough to give you the full power of it. My idea was to target pirate ships with those illegal Modified Blasters that run hotter than usual."`
			`	"I guess that makes sense," you say, "although I wouldn't want to run out of jump fuel by accident. Are you going to be making them available for sale?"`
				goto available
			label available
			`	"Well, I should have an initial model for sale in a month or so," he says. "I'll be interested to see what uses you or anyone else might find for them. Anyway, thanks for your help." You say goodbye and head back to your ship.`

ship "Fury" "Doombat"
	add attributes
		"self destruct" 1
	outfits
		"Flamethrower" 4
		"nGVF-BB Fuel Cell"
		"Supercapacitor"
		"D14-RN Shield Generator"
		"Ramscoop"
		"X2700 Ion Thruster"
		"X2200 Ion Steering"
		"Hyperdrive"



mission "FW Wolf Pack 1"
	minor
	name "Ramscoop Technology"
	description "Travel to <planet> in the Deep, where Free Worlds sympathizers will share details of a new ramscoop technology. (You may have to bribe planets along the way to get permission to refuel.)"
	source
		government "Free Worlds"
	destination "Memory"
	clearance
	to offer
		has "event: catalytic ramscoop available"
		random < 30
		not "event: fw armistice"
	to fail
		has "event: fw armistice"
	
	on offer
		conversation
			`When you stop by the spaceport bar, a militia officer who you don't recognize gestures for you to join him. "Captain <last>!" he says. "I'd be honored if you'd let me buy you a drink."`
			choice
				`	"Thank you!"`
					goto drink
				`	"Sorry, I don't drink."`
			`	"Then what are you doing in a bar?" he asks. "Never mind, don't answer that. I assume you're here looking for valuable work to do, and if that's the case, I could really use your help."`
				goto mission
			label drink
			`	He buys you a drink, and you sit down at his table. After making small talk for a few minutes, he says, "By the way, I could really use your help with a mission for the Free Worlds."`
			label mission
			`	"Okay," you say, "tell me more."`
			`	He says, "You probably know that we have a network of Free Worlds sympathizers throughout much of Republic space. One of our contacts recently sent us word of a new technology that is for sale in the Deep, which could be very useful to us. But they have no way to ship it to us, so I need someone who can travel up to the Deep and retrieve it."`
			choice
				`	"Will your contacts also provide me with planets to refuel on along the way?"`
				`	"The Deep is farther away than my fuel tanks can take me."`
			`	"You'll have to bribe some Dirt Belt worlds into letting you land, to get there," he says. "Or, you could wait for the next time there's a ceasefire. But here's the great part: if this works, you won't need to pay any bribes on the way back, because the new technology we're after is a super-efficient ramscoop. What do you say?"`
			choice
				`	"Okay, I'll give it a try."`
					accept
				`	"Sorry, this sounds way too risky to me."`
					decline



mission "FW Wolf Pack 1B"
	landing
	name "Ramscoop Technology"
	description "Return to Free space with the plans for a new, more efficient ramscoop, and deliver them to Delta V Corporation on <destination>."
	destination "Solace"
	cargo "Ramscoop Data Card" 0
	to offer
		has "FW Wolf Pack 1: done"
		not "event: fw armistice"
	to fail
		has "event: fw armistice"
	
	on offer
		conversation
			`You land your ship by night in a private hangar that you assume is owned by one of the elite families on <origin>. Your contact is wearing a black mask over his face. That seems unnecessary to you, but perhaps he is just really enjoying the thrill of being involved in something illegal. He hands you a data card and says, "This contains all the information you will need to build your own Catalytic Ramscoop. And before you leave, you may also visit our private outfitter and purchase one of your own, if you wish."`
			choice
				`	"Thank you."`
					goto leave
				`	"May I ask who you are and why you sympathize with us?"`
			`	"You can call me... Agent Falco. As to my true identity, naturally you will understand that I cannot divulge it."`
			`	"Of course," you say.`
			label leave
			`	"I wish you the best of luck in your struggle against the evil plutocrats," he says. "May we yet live to see the day when all people live in prosperity and freedom. Farewell, brave insurgent." It is an overly dramatic speech, and sounds like he's been rehearsing it for a while. You respond with what you hope is a properly elegant salute, and he leaves.`
				accept
	
	on complete
		payment 250000
		event "fw gets catalytic ramscoop" 24
		log "Helped the Free Worlds gain access to new ramscoop technology that has been developed in the Deep. This should make it significantly easier to travel long distances through unfriendly systems."
		dialog `You deliver the data card with the details of the Catalytic Ramscoop to the contact you were given in the Delta V corporation. "Excellent," she says. "We have been trying to duplicate their work for months, but this will make it much easier." She hands you a credit chip worth <payment>, and says, "We'll contact you when we've begun mass-producing the new ramscoops. I hope they will be useful in the conflict ahead."`



mission "FW Wolf Pack 2"
	landing
	name `"Wolf Pack" Recruiting`
	description `A group identifying themselves as the "Free Worlds Wolf Pack" has asked you to visit them on <planet> if you want to aid their work against the Republic.`
	source
		government "Free Worlds"
	destination "Solace"
	to offer
		has "FW Wolf Pack 1B: done"
		has "event: fw gets catalytic ramscoop"
		not "event: fw armistice"
	to fail
		has "event: fw armistice"
	
	on offer
		conversation
			`Soon after you land on <origin>, you receive an anonymous message. It reads:`
			``
			`Dear Captain <last>,`
			`	Thanks to your assistance, the Delta V engineers have succeeded in duplicating Deep Sky's new ramscoop technology. The ramscoop is one piece in a larger plan we have to shift the tide of this war in favor of the Free Worlds, and to bring about an end to the conflict more quickly. If you are interested in hearing more, please visit <planet>, and our representatives will contact you promptly.`
			`	Sincerely,`
			`		The Free Worlds Wolf Pack`
			``
			`You have never heard of this organization before, but you know that "wolf pack" is pirate slang for a temporary alliance formed for the sake of taking on a target larger than any one band of pirates could handle alone.`
				accept



mission "FW Wolf Pack 2A"
	landing
	name "Attack Food Convoy"
	description "Destroy three Republic freighters in the <waypoints> system that are carrying food, then report back to <planet> for payment."
	source "Solace"
	waypoint "Sarin"
	to offer
		has "FW Wolf Pack 2: done"
		not "event: fw armistice"
	to fail
		has "event: fw armistice"
	
	on offer
		conversation
			`Soon after you land, two men in militia uniforms approach your ship, and tell you they represent the "Wolf Pack." They introduce themselves as Rex and Fido; you're pretty sure those are not their real names.`
			`	Once you are in a private room inside your ship, Rex, who is the younger one, says, "With ramscoop technology, our ships will be able to venture deep into the Dirt Belt. Now, Captain, why do you think the Republic is so determined to hold on to the Dirt Belt, even if it means fighting bloody battles? It's clear that the tax revenue isn't worth it."`
			choice
				`	"Maybe it's just the principle of not ceding territory without a fight."`
				`	"Maybe they want the resources that the Dirt Belt produces?"`
					goto resources
				`	"Maybe to keep a buffer in between our territory and the worlds that really matter to them, like Earth and the Paradise Planets?"`
			`	"That might be part of it," says Rex, "but there is a larger reason."`
				goto map
			label resources
			`	"Precisely," says Rex, "and one resource in particular is more important to them than all the rest combined."`
			label map
			`	The man named Fido, who is older and has a thick beard, spreads out a map on the table. You recognize it as a chart of food prices throughout human space. "Food," says Rex. "The Dirt Belt is the breadbasket of the galaxy. And the Republic is full of teeming, overpopulated worlds that could never hope to feed themselves. If we cut off the supply of food, the Republic will be forced to make peace with us."`
			`	Fido says, "We are proposing a concentrated effort to destroy the freighter convoys that bring food to the richest, most densely populated Republic worlds. When their citizens find themselves lacking basic supplies, they will demand an end to the war."`
			choice
				`	"I'd be glad to join you. That does sound like a much quicker solution than our current policies that the Senate and the Council support."`
					goto join
				`	"You're trying to starve the Republic into submission? Won't that just add more brutality to a war that has already been far too bloody?"`
			`	"In the short run, perhaps," says Rex. "But think how many lives will be saved - how many bloody battles will be averted - by forcing them to end this war quickly rather than dragging it out across years of time."`
			choice
				`	"I don't buy your argument. If we use such reprehensible tactics to build our new society, the society we build will be as corrupt as the old one."`
				`	"Okay, you've convinced me. What do you want me to do?"`
					goto join
			`	"Very well," says Rex. "Sorry for wasting your time." They leave.`
				decline
			label join
			`	"First, you should buy a ramscoop here, if you haven't got one already," says Rex. "Then, your first target is a convoy of three freighters that will be departing from Big Sky in the Sarin system shortly. There may be escorts, but only the freighters themselves need to be destroyed."`
				accept
	
	npc kill
		government "Republic"
		system "Sarin"
		personality timid staying target
		"cargo settings"
			commodities "Food"
		ship "Freighter" "Horn of Plenty"
		ship "Freighter" "Autumn Twilight"
		ship "Freighter" "Bounty Harvest"
		dialog "You have destroyed all the target freighters. Time to report back to the Wolf Pack on Solace."
	npc
		government "Republic"
		system "Sarin"
		personality heroic staying
		ship "Gunboat (Mark II)" "R.N.S. Atherstone"
		ship "Gunboat (Mark II)" "R.N.S. Tyndale"
	
	on visit
		dialog `You've landed on <planet>, but the freighters have not been eliminated yet. Hunt them down in the Sarin system and destroy them before returning.`
	on complete
		karma --
		event "wolf pack 3 ready" 10
		payment 200000
		log "Destroyed a convoy of Republic freighters that was carrying food from the Dirt Belt. The Paradise Worlds cannot grow all the food that they need to feed their populations, so cutting off the flow of supplies from the Dirt Belt will put pressure on them to make peace with the Free Worlds."
		dialog `Rex, one of the "Wolf Pack" men you spoke with earlier, meets you in the spaceport and hands you a credit chip for <payment>. "Good work," he says. "We'll contact you when we have another target selected."`



event "wolf pack 3 ready"

event "wolf pack gacrux start"
	system "Gacrux"
		fleet "Small Southern Merchants" 2000
		fleet "Large Southern Merchants" 5000
		fleet "Small Southern Pirates" 2000
		fleet "Large Southern Pirates" 4000
		fleet "Small Republic" 8000

event "wolf pack gacrux end"
	system "Gacrux"
		fleet "Small Southern Merchants" 2000
		fleet "Large Southern Merchants" 5000
		fleet "Small Southern Pirates" 2000
		fleet "Large Southern Pirates" 4000
		fleet "Small Republic" 2000
		fleet "Large Republic" 3000
		fleet "Navy Surveillance" 1600



mission "FW Wolf Pack 3"
	landing
	name "Attack Food Convoy"
	description "Destroy two Republic Bulk Freighters in the Gacrux system that are carrying food, then report back to <planet> for payment."
	source
		government "Free Worlds"
	destination "Solace"
	waypoint "Gacrux"
	to offer
		has "FW Wolf Pack 2A: done"
		has "event: wolf pack 3 ready"
		not "event: fw armistice"
	to fail
		has "event: fw armistice"
	
	on offer
		dialog
			`You receive another message from the Wolf Pack: "Great work with those freighters, Captain! We've got another target for you, if you're interested: a pair of Bulk Freighters, which you ought to be able to intercept in the Gacrux system. It's an uninhabited system, so you shouldn't have much interference from the Navy. As before, you only need to destroy the freighters, not any other ships you encounter."`
			`	Every one of these missions you complete will create more animosity between the Republic and the Free Worlds. But on the other hand, they may be right that it's the fastest way to bring this war to a close.`
	
	on accept
		event "wolf pack gacrux start"
	on fail
		event "wolf pack gacrux end"

	npc kill
		government "Republic"
		system "Gacrux"
		personality timid staying target
		"cargo settings"
			commodities "Food"
		ship "Bulk Freighter" "Dew of the Morning"
		ship "Bulk Freighter" "Heaven's Blessing"
		dialog "The food convoy has been destroyed. You can now return to Solace."
	npc
		government "Republic"
		system "Gacrux"
		personality heroic staying
		ship "Protector (Laser)" "R.N.S. Bulwark"
		ship "Protector" "R.N.S. Citadel"
		ship "Protector" "R.N.S. Rampart"
	
	on visit
		dialog `You've landed on <planet>, but the freighters have not been eliminated yet. Hunt them down in the Gacrux system and destroy them before returning.`
	on complete
		karma --
		event "wolf pack gacrux end"
		event "wolf pack 4 ready" 20
		payment 300000
		log "Destroyed an even larger Republic food convoy. They are probably beginning to feel the pressure now, because they have clearly started to divert warships from the front to defend these convoys."
		dialog `Once again, Rex from the Wolf Pack meets you soon after your ship lands. This time, he pays you <payment>. "I hope they didn't give you any trouble," he says. "We'll be in touch when there's another target to strike."`



event "wolf pack 4 ready"

event "wolf pack mizar start"
	system "Mizar"
		fleet "Small Southern Merchants" 1400
		fleet "Large Southern Merchants" 4500
		fleet "Small Republic" 5000
		fleet "Small Southern Pirates" 9000

event "wolf pack mizar end"
	system "Mizar"
		fleet "Small Southern Merchants" 1400
		fleet "Large Southern Merchants" 4500
		fleet "Small Republic" 1000
		fleet "Large Republic" 1400
		fleet "Small Southern Pirates" 9000
		fleet "Navy Surveillance" 2000



mission "FW Wolf Pack 4"
	landing
	name "Attack Food Convoy"
	description "Destroy a Republic Auxiliary freighter in the <waypoints> system that is carrying food, then report back to <planet> for payment."
	source
		government "Free Worlds"
	destination "Solace"
	waypoint "Mizar"
	to offer
		has "FW Wolf Pack 3: done"
		has "event: wolf pack 4 ready"
		not "event: fw armistice"
	to fail
		has "event: fw armistice"
	
	on offer
		dialog `You receive another message from the Wolf Pack: "Hello Captain. If nothing else, we've certainly succeeded in getting some of the Navy's ships diverted from the front, to serve as escorts! Your next target, if you're willing to help us again, will be a bit tougher: an Auxiliary freighter, probably with Navy escorts. The freighter is passing through the <waypoints> system. Interested?"`
	
	on accept
		event "wolf pack mizar start"
	on fail
		event "wolf pack mizar end"

	npc kill
		government "Republic"
		system "Mizar"
		personality timid staying target
		"cargo settings"
			commodities "Food"
		ship "Auxiliary (Cargo Mark II)" "R.N.S. Golden Fleece"
		dialog "You have eliminated the Auxiliary that was carrying food to the Republic. Time to report back to the Wolf Pack and receive your reward."
	npc
		government "Republic"
		system "Mizar"
		personality heroic staying
		fleet
			names "republic capital"
			fighters
				names "republic fighter"
			cargo 0
			variant
				"Carrier"
				"Lance" 8
				"Combat Drone" 6
	
	on visit
		dialog `You've landed on <planet>, but the freighter has not been eliminated yet. Hunt it down in the Mizar system and destroy it before returning.`
	on complete
		karma --
		event "wolf pack mizar end"
		log "Destroyed a third food convoy. These attacks seem to have succeeded in forcing the Navy to assign capital ships to defend their supply convoys."
		payment 400000
		dialog
			`Rex meets up with you and thanks you for your continued service to the Free Worlds. "If we had a dozen captains as brave as you are," he says, "the war would be over tomorrow." He hands you <payment>, and walks away. You still don't know his real name or who the leaders of the Wolf Pack are, but you are glad to have been able to do something extra to assist the war effort.`



mission "FW Stack Core 1"
	landing
	name "Escort convoy from Rand"
	description "Freya asked you to stop by Rand if you are able, to help escort a freighter convoy carrying vital supplies for building some exciting new equipment."
	destination "Rand"
	to offer
		has "FW Reconciliation Break: offered"
	to fail
		has "event: pug invasion"
	
	on offer
		conversation
			`You receive a short, encoded message from Freya: "Hi there, Captain! If you happen to be passing by <planet> any time soon, would you mind swinging by there to help escort a freighter convoy? We're working on the development of some exciting new equipment, and the convoy is carrying the supplies we need to complete the project."`
				accept



mission "FWC Stack Core 1"
	landing
	name "Escort convoy from Rand"
	description "Freya asked you to stop by Rand if you are able, to help escort a freighter convoy carrying vital supplies for building some exciting new equipment."
	destination "Rand"
	to offer
		has "FW Liberate Delta Sagittarii: done"
	to fail
		has "event: fwc pug invasion"
	
	on complete
		set "FW Stack Core 1: done"



mission "FW Stack Core 1B"
	landing
	name "Escort convoy from Rand"
	description "Freya asked you to escort this convoy carrying vital supplies for building some exciting new equipment, to <destination>."
	source "Rand"
	destination "Solace"
	to offer
		has "FW Stack Core 1: done"
	
	on offer
		conversation
			`Following Freya's instructions, you land on <origin> and tell the spaceport quartermaster that you've been assigned to escort a convoy to <planet>. "Ah yes," he says, "the last of their cargo was just made ready yesterday." He leads you to a cluster of landing pads where three Bulk Freighters are parked. "The pirates have not been much trouble lately," he says, "but the cargo is important enough that they wanted an escort anyway." He leaves before you have a chance to ask any questions about what the freighters are carrying.`
				accept
	
	npc accompany save
		government "Free Worlds"
		personality escort disables
		fleet
			names "civilian"
			cargo 3
			variant
				"Bulk Freighter" 3
	npc
		government "Republic"
		system "Menkent"
		personality surveillance
		fleet
			names "republic capital"
			cargo 0
			variant
				"Gunboat" 2
	
	on visit
		dialog "You have reached <planet>, but you left part of your convoy behind! Better depart and wait for them to arrive in this star system."
	on complete
		event "stack core for sale" 25
		payment 200000
		dialog `You have escorted the convoy safely to its destination. The workers begin unloading some very heavy crates, and one of the freighter captains hands you <payment> and thanks you for your protection.`



mission "FW Stack Core 1C"
	minor
	landing
	source
		near "Pherkad" 100
	to offer
		not "main plot completed"
		has "event: stack core for sale"
	
	on offer
		log "The Free Worlds now has a new reactor core of their own design available for sale, specifically for increasing the Dreadnought's energy performance."
		conversation
			`You receive a message from Freya: "Hello again, Captain! Thanks for your help escorting the materials to Solace. Ever since we developed the Dreadnoughts people have been talking about how badly we need a generator that can meet their energy needs, and that's what Delta V Corporation has been working on. So, take a look next time you're on Solace or one of our other major manufacturing centers. Sorry for the mystery surrounding the cargo, but we didn't exactly want to advertise that a huge shipment of fissionable material was headed for Free Worlds space."`
				decline

mission "FW Greenrock Lost Announcement"
	invisible
	landing
	source
		government "Free Worlds"
	to offer
		has "event: fw abandoned Greenrock"
	on offer
		conversation
			`While waiting in <planet>'s spaceport for your ship to be refueled, you hear an announcement coming from an unseen loudspeaker. "Attention! The Free Worlds have withdrawn our presence from Greenrock. Be advised that any further travel to the Shaula system may carry the risk of pirate attacks." The message cuts off abruptly, only to repeat a few minutes later.`
			`	A militia captain who paused nearby to listen to the announcement shakes his head before recognizing you. "Well, that's a damn shame, isn't it?"`
			choice
				`	"Yeah, I risked my life and position taking Greenrock."`
					goto risked
					to display
						has "FW Pirates: Attack 3: done"
				`	"It was probably going to happen sooner or later."`
				`	"We shouldn't have wasted the resources on it at all."`
			`	"I suppose, but things should have gone differently. The Free Worlds, and the Pact before that, was founded to eliminate piracy from the South, so I thought it was the right thing to do. We really put the pirates on the wire when we went straight for their guts.`
			choice
				`	"Well, the most obvious threat to the Free Worlds' sovereignty is the Navy. Attacking Greenrock hasn't helped in that regard."`
					goto challenge
				`	"Tomek's plan didn't work out, though. The other pirate planets didn't surrender when Greenrock fell, like he had wanted."`
			`	"That's true. But we mustn't lose sight of our original goals, either. Piracy is a bloody stain on the Southern Rim, and every ship we lose fighting a petty war between Bourne and Earth is a ship that can't protect our families on Solace or Longjump from the horrors of piracy.`
			`	"But now it looks like we'll have our hands full for the foreseeable future, and the pirates are going to make the most out of this for sure. Best to see this war over with."`
				goto end

			label risked
			`	"I was at Shaula that day too, although it wasn't me who was commanding the ship. I thought my old captain did the right thing at that time, but he took the fall for it when the Senate began to butt their heads into our business. Even when Bourne decided overriding the orders of their most capable combat commander was a severe misjudgement, they go and disregard all our sacrifices in Shaula and throw Greenrock back to the jackals."`
			choice
				`	"Perhaps the Senate made a wise decision this time around. After all, Tomek's plan relied on the rest of the pirate worlds surrendering after Greenrock, and that didn't happen."`
				`	"There's little we can do now. The challenge now is the Navy, not the pirates."`
					goto challenge
				`	(Stay silent.)`
					goto silent
			`	"You could make a case there. In the circumstances, it seemed like attacking Greenrock could have taken a lot of weight off our shoulders... but nonetheless, after the lull in action following Wei I think the Senate could have handled Greenrock far better."`
				goto end

			label challenge
			`	"That may be true, but I still believe it was a lost opportunity. We've had all this time since then to stabilize the situation in Shaula, yet the Senate has done nothing so they can prove the Greenrock occupation was a waste of resources."`

			label silent
			`	The militia captain continues, "It's really too bad, we really put the pirates on the wire when we went straight for their guts. But now it looks like we'll have our hands full for the foreseeable future, and the pirates are going to make the most out of this for sure."`
			label end
			`	On that note, the two of you return to your duties.`
				decline
